from chapter5.regular_expression.testre.re_test_patterns import test_patterns

if __name__ == '__main__':
    text = "This is some text -- with punctuation."

    patterns = [
        (r"^\w+", "句首的词"),
        (r"\A\w+", "句首的词"),
        (r"\w+\S*$", "句尾的词加上标点"),
        (r"\w+\S*\Z", "句尾的词加上标点"),
        (r"\w*t\w*", "含有字符 t 的词"),
        (r"\bt\w*", "以字符 t 开头的词"),
        (r"\w*t\b", "以字符 t 结尾的词"),
        (r"\w+\Bt\B\w+", "包含字符 t，但是 t 不在开头也不在结尾")
    ]

    test_patterns(text=text, patterns=patterns)
